<?
function &Member_CheckLogin($member_id, $password)
{
	$member_info =& Member_GetMemberInfo($member_id, null, true);
	if (!$member_info)
		return array('login_state'	=> -1);

	if ($member_info->getString('member_pwd') != $password)
		return array('login_state'	=> -1);

	$login_info = array(
		'login_state'	=> 1,
		'userno'		=> $member_info->getNumber('member_seq'),
		'userid'		=> $member_id,
		'userlvl'  		=> $member_info->getNumber('member_grade'),
	);
	return $login_info;
}

function &Member_GetMemberInfo($member_id, $member_seq , $isAlive = false)
{
	$member_id = mysql_real_escape_string(stripslashes($member_id));
	$member_seq = mysql_real_escape_string(stripslashes($member_seq));
	
	$db =& GetDefaultConnection();
	$query  = "SELECT ";
	$query .=" member_seq, ";
	$query .=" member_id, ";
	$query .=" member_pwd, ";
	$query .=" member_hp, ";
	$query .=" member_grade, ";
	$query .=" jbnh_seq, ";		
	$query .=" member_delyn, ";
	$query .=" member_update, "; 
	$query .=" member_regdate ";
	$query .=" FROM TB_MEMBER ";
	
	if ( $member_id != null  )
		$query .=" WHERE MEMBER_ID = '%s' ";
	else if ( $member_seq != null  )
		$query .=" WHERE MEMBER_SEQ = '%s' ";
	if ( $isAlive )
		$query .=" AND MEMBER_DELYN = 'N' ";

	if ( $member_id != null )
		$sql = sprintf($query,$member_id);
	else if ( $member_seq != null )
		$sql = sprintf($query,$member_seq);
	
	$row =& $db->queryRow($sql);
	return $row;
}
?>